{include file="entete.tpl"}
{literal}
<script type="text/javascript" src= "/PariGest/pages/js/prototype.js"></script>
<script type="text/javascript" src= "/PariGest/pages/js/outilsAjax.js"></script>
<script type="text/javascript">
function init()
{
  ajouteCtrl({input:{/literal}$("Date"){literal}, ctrl: "DATE", oblig: true, message: "Date"});
  ajouteCtrl({input:{/literal}$("Montant"){literal}, ctrl: "FLOAT", oblig: true, message: "Montant"});
  ajouteCtrl({input:{/literal}$("NumPage"){literal}, ctrl: "INT", oblig: true, message: "NumPage"});
}

function afficheCommentaire(img, input)
{  
  top.afficheModal();
  top.$('popCommentaire').style.zIndex = "9000";
  top.$('popCommentaire').show();
  top.$('commentaire').value=$F(input);  
  top.$('returnVal').value=input;
  top.$('imgComment').value=img.name;
}

function changeTypeOp()
{
  if( $F("LstTypeOp") == "D" )
  {
    $("SigneOp").hide();
  }
  else if( $F("LstTypeOp") == "R" )
  {
    $("SigneOp").show();
  }
  else
  {
    $("SigneOp").hide();
  }  
}

function pageFirst()
{
  //if( !isFormOk() ) return;
  if( $F("NumPage") == 1 ) return;
  $("ActionMultiPage").value = "FIRST";
  document.forms[0].submit();
}

function pageLast()
{
  //if( !isFormOk() ) return;

  if( $F("NumPage") == $F("NbPages") ) return;  
  $("ActionMultiPage").value = "LAST";
  document.forms[0].submit();
}

function pagePrev()
{
  //if( !isFormOk() ) return;
  if( $F("NumPage") == 1 ) return;
  $("ActionMultiPage").value = "PREV";
  document.forms[0].submit();
}

function pageNext()
{
  //if( !isFormOk() ) return;
  if( $F("NumPage") == $F("NbPages") ) return;  
  $("ActionMultiPage").value = "NEXT";
  document.forms[0].submit();
}

function changeNumPage()
{
  if( !verifCtrl($("NumPage")) )
   return;
  if( parseInt($F("NumPage")) > parseInt($F("NbPages")) )
  {
    alert("Le numéro de page doit être inférieur à "+$F("NbPages"));
   return;
  }  
  if( parseInt($F("NumPage")) < 1 )
  {
    alert("Le numéro de page doit être supérieur à 1");
   return;
  }
  document.forms[0].submit();
}
</script>
{/literal}
<html>
  <body onload="init();">
    <form action="operation_compte.php" method="post">
    
      {include file="IncSelectCompte.tpl"}
        
      <input type="hidden" name="Action" id="Action" value="">
      <input type="hidden" name="ActionMultiPage" id="ActionMultiPage" value="">
      
      <table border=0 cellspacing=5 cellpadding=0 class=lib>	
        <tr>
          <td>le&nbsp;<input type="text" name="Date" id="Date" size="10" onChange="verifCtrl(this)" value="{$DateDuJour|date_format:"%d/%m/%Y"}"></td>
          <td>
            <select name="LstTypeOp" id="LstTypeOp" onchange="changeTypeOp()">
              {html_options options=$LstTypeOp selected=$LstTypeOpSelected}
            </select>
          </td>
          <td><span id="SigneOp" style="display:none">-</span><input type="text" size=6 name="Montant" id="Montant" value="Montant" onChange="verifCtrl(this)" onFocus="if(this.value == 'Montant') this.value = ''" onBlur="if(this.value == '') this.value = 'Montant'"></td>
          <td><input type="text" style="width:100%" name="Libelle" id="Libelle" value="Libelle" onChange="verifCtrl(this)" onFocus="if(this.value == 'Libelle') this.value = ''" onBlur="if(this.value == '') this.value = 'Libelle'"></td>
          <td>
              {assign var=imgComment value='comment_vide'}
              <input type=hidden id='Commentaire' name='Commentaire' value=''>
              <img style='vertical-align:middle;' src='/PariGest/pages/ihm/boutons/comment_vide0.png' class='cursmain' title='Commentaire' 
                   onmouseover=rollBtn(this,'comment_vide1') onmouseout= rollBtn(this,'comment_vide0') 
                   id='btn_Commentaire' name='btn_Commentaire' onclick="afficheCommentaire(this, 'Commentaire')">
          </td>
        </tr>
      </table>
      <table style="width:100%" align="center">
        <tr>
          <td style="width:50%">&nbsp;</td>
          <td><img width="20" height="20" style='vertical-align:middle;' src='/PariGest/pages/ihm/boutons/pageFirst0.png' class='cursmain' title='Première page' 
                   onmouseover=rollBtn(this,'pageFirst1') onmouseout= rollBtn(this,'pageFirst0') 
                   id='btn_PageFirst' name='btn_PageFirst' onclick="pageFirst()"></td>
          <td><img width="20" height="20" style='vertical-align:middle;' src='/PariGest/pages/ihm/boutons/pagePrev0.png' class='cursmain' title='Page précédente' 
                   onmouseover=rollBtn(this,'pagePrev1') onmouseout= rollBtn(this,'pagePrev0') 
                   id='btn_PagePrev' name='btn_PagePrev' onclick="pagePrev()"></td>
          <td nowrap>page&nbsp;<input type="text" name="NumPage" id="NumPage" value="{$NumPage}" size="1" onChange="changeNumPage()">/<input type="text" class="lect" readonly tabIndex=-1 name="NbPages" id="NbPages" value="{$NbPages}" size="1"></td>
          <td><img width="20" height="20" style='vertical-align:middle;' src='/PariGest/pages/ihm/boutons/pageNext0.png' class='cursmain' title='Page suivante' 
                   onmouseover=rollBtn(this,'pageNext1') onmouseout= rollBtn(this,'pageNext0') 
                   id='btn_PageNext' name='btn_PageNext' onclick="pageNext()"></td>
          <td><img width="20" height="20" style='vertical-align:middle;' src='/PariGest/pages/ihm/boutons/pageLast0.png' class='cursmain' title='Dernière page' 
                   onmouseover=rollBtn(this,'pageLast1') onmouseout= rollBtn(this,'pageLast0') 
                   id='btn_PageLast' name='btn_PageLast' onclick="pageLast()"></td>
          <td>{$NbEnregParPage}</td>
          <td style="width:50%">&nbsp;</td>
        </tr>
      </table>
      <table id="LstOperations">
        <tr>
          <td>Date</td>
          <td>Libellé</td>
          <td>Montant</td>
          <td>Type</td>
          <td>Commentaire</td>
        </tr>
      {foreach from=$LstOperations item=ligne name=operation}
          <tr>
            <td style="width:20%">{$ligne.Date}</td>
            <td style="width:40%">{$ligne.Libelle}</td>
            <td style="width:10%">{$ligne.Montant}</td>
            <td style="width:10%">{$ligne.IdType}</td>
            <td style="width:20%">{$ligne.Commentaire}</td>
          </tr>
      {/foreach}  
      </table>
      
    </form>
  </body>
</html>